#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int n;
    int a[50] = { 0 };
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    int t = 0;
    scanf("%d", &t);
    int j = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] == t)
        {
            continue;
        }
        a[j++] = a[i];
    }
    for (int i = 0; i < j; i++)
    {
        printf("%d ", a[i]);
    }
    return 0;
}